import axios from "./index";

export async function addBanner(picUrl: string): Promise<any> {
  let response = await axios.post("/banners", {
    pic: picUrl,
  });
  return response.data;
}

export async function getBanners(): Promise<{
  data: {
    id: number;
    pic: string;
  }[];
}> {
  let response = await axios.get("/banners");
  return response.data;
}
export async function updateBanner(id: number, picUrl: string): Promise<any> {
  let response = await axios.put(`/banners/${id}`, {
    pic: picUrl,
  });
  return response.data;
}
export async function deleteBanner(id: number): Promise<any> {
  let response = await axios.delete(`/banners/${id}`);
  return response.data;
}
